﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;

namespace WordXmlComparer
{
    class Transform
    {
        public static string ConvertToContentToXmlFile(string wordprocessingML, string fileName)
        {
            StringBuilder response = new StringBuilder();
            try
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(wordprocessingML);
                using (XmlTextWriter writer = new XmlTextWriter(fileName, Encoding.UTF8))
                {
                    writer.Formatting = Formatting.Indented;
                    document.WriteContentTo(writer);
                }
            }
            catch (Exception e)
            {
                response.Append("Error " + e.Message);
            }
            return response.ToString();
        }
    }
}
